<%--
  Created by IntelliJ IDEA.
  User: zhf
  Date: 2021/2/12
  Time: 12:50
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" %>
<%@taglib prefix="fix" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>导航栏</title>
</head>
<body>
<nav class="navbar navbar-default">
    <div class="container-fluid">

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div  class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav" id="navBarControl">
                <c:choose>
                    <c:when test="${param.currentPage eq 'index.jsp' }">
                        <li class="active" id="studentLi"><a href="index.do" id = "studentBar">学生管理</a></li>
                        <li id="classLi"><a href="classQueryAll" id="classBar" id="classBar">班级管理</a></li>
                    </c:when>
                    <c:otherwise>
                        <li  id="studentLi"><a href="index.do" id = "studentBar">学生管理</a></li>
                        <li class="active" id="classLi"><a href="classQueryAll" id="classBar" id="classBar">班级管理</a></li>
                    </c:otherwise>
                </c:choose>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>
</body>
<script>
    $("#studentBar").on("click",function () {
        const studentLi = $(this).parent();
        studentLi.siblings("#classLi").removeClass();
        studentLi.attr("class", "active");
    });
    $("#classBar").on("click",function () {
        const classLi = $(this).parent();
        classLi.siblings("#studentLi").removeClass();
        classLi.attr("class", "active");
    })
</script>
</html>
